<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8" />
    <title>管理-用户列表</title>
    <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
    <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
    <link rel="stylesheet" href="/app/admin/admin/css/pages/user-index.css" />
  </head>
  <body class="pear-container">

    <!-- 顶部查询表单 -->
    <div class="layui-card">
      <div class="layui-card-body">

        <form class="layui-form top-search-from">
          <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
              <input type="text" name="username" value="" class="layui-input" />
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">创建时间</label>
            <div class="layui-input-block">
              <div class="layui-input-block" id="created_at">
                <input
                  type="text"
                  autocomplete="off"
                  name="created_at[]"
                  id="created_at-date-start"
                  class="layui-input inline-block"
                  placeholder="开始时间"
                />
                -
                <input
                  type="text"
                  autocomplete="off"
                  name="created_at[]"
                  id="created_at-date-end"
                  class="layui-input inline-block"
                  placeholder="结束时间"
                />
              </div>
            </div>
          </div>

          <div class="layui-form-item layui-inline">
            <label class="layui-form-label"></label>
            <button
              class="pear-btn pear-btn-md pear-btn-primary"
              lay-submit
              lay-filter="table-query"
            >
              <i class="layui-icon layui-icon-search"></i>查询
            </button>
            <button
              type="reset"
              class="pear-btn pear-btn-md"
              lay-submit
              lay-filter="table-reset"
            >
              <i class="layui-icon layui-icon-refresh"></i>重置
            </button>
          </div>
          <div class="toggle-btn">
            <a class="layui-hide"
              >展开<i class="layui-icon layui-icon-down"></i
            ></a>
            <a class="layui-hide"
              >收起<i class="layui-icon layui-icon-up"></i
            ></a>
          </div>
        </form>
      </div>
    </div>

    <!-- 数据表格 -->
    <div class="layui-card">
      <div class="layui-card-body">
        <table id="data-table" lay-filter="data-table"></table>
      </div>
    </div>

    <!-- 表格顶部工具栏 -->
<!--    <script type="text/html" id="table-toolbar">-->
<!--      <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add" permission="app.admin.v1user.insert">-->
<!--          <i class="layui-icon layui-icon-add-1"></i>新增-->
<!--      </button>-->
<!--      <button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove" permission="app.admin.v1user.delete">-->
<!--          <i class="layui-icon layui-icon-delete"></i>删除-->
<!--      </button>-->
<!--    </script>-->

    <!-- 表格行工具栏 -->
    <script type="text/html" id="table-bar">
      <button class="pear-btn pear-btn-xs tool-btn" lay-event="money" permission="app.admin.v1user.money">余额</button>
      <button class="pear-btn pear-btn-xs tool-btn" lay-event="commission" permission="app.admin.v1user.commission">佣金</button>
      <button class="pear-btn pear-btn-xs tool-btn" lay-event="invitation" permission="app.admin.v1user.invitation">修改上级</button>
      <button class="pear-btn pear-btn-xs tool-btn" lay-event="user_extend" permission="app.admin.v1user.user_extend">权限设置</button>
      <button class="pear-btn pear-btn-xs tool-btn" lay-event="user_money_log" permission="app.admin.v1usermoneylog.select">资金记录</button>
      <button plain class="pear-btn pear-btn-xs pear-btn-primary" id="more_{{d.id}}" lay-event="more" permission="app.admin.v1ordernode.select">节点管理<i class="layui-icon layui-icon-triangle-d"></i></button>

<!--            <button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.v1user.delete">删除</button>-->
    </script>

    <!-- 推广设置 -->
    <div class="promotion-link-setting-wrapper" style="display: none">
      <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title" id="promotion-tab"></ul>
        <div
          class="layui-tab-content"
          id="promotion-tab-contact"
          style="height: 30px"
        ></div>
      </div>
    </div>

    <script src="/app/admin/component/layui/layui.js?v=2.8.12"></script>
    <script src="/app/admin/component/pear/pear.js"></script>
    <script src="/app/admin/admin/js/permission.js"></script>
    <script src="/app/admin/admin/js/common.js"></script>
    <script src="/app/admin/admin/js/user-index.js"></script>
    <script>
      // 相关常量
      const PRIMARY_KEY = 'id'
      const SELECT_API = '/app/admin/v1-user/select'
      const UPDATE_API = '/app/admin/v1-user/update'
      const DELETE_API = '/app/admin/v1-user/delete'
      const INSERT_URL = '/app/admin/v1-user/insert'
      const UPDATE_URL = '/app/admin/v1-user/update'

      const MONEY_URL = '/app/admin/v1-user/money'
      const COMMISSION_URL = '/app/admin/v1-user/commission'
      const MONEY_API = '/app/admin/v1-user/money'
      const INVITATION_API = '/app/admin/v1-user/invitation'

      // 字段 创建时间 created_at
      layui.use(['laydate'], function () {
        layui.laydate.render({
          elem: '#created_at',
          range: ['#created_at-date-start', '#created_at-date-end'],
        })
      })

      // 表格渲染
      layui.use(['table', 'form', 'common', 'popup', 'util','dropdown'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.$
        let common = layui.common
        let util = layui.util
        let dropdown = layui.dropdown

        let user_status = "<?=$admin['user_status']?>";

        // 表头参数
        let cols = [
          {
            type: 'checkbox',
            align: 'left',
            width: 50,
          },
          {
            title: '主键',
            align: 'left',
            field: 'id',
            sort: true,
            width: 110,
          },
          {
            title: '上级用户名',
            align: 'left',
            field: 'invitation',
            width: 140,
          },
          {
            title: '用户名',
            align: 'left',
            field: 'username',
            width: 140,
          },
          {
            title: '手机号',
            align: 'left',
            field: 'mobile',
            width: 150,
          },
          {
            title: '密码',
            align: 'left',
            field: 'password_new',
            width: 100,
          },
          // {
          //   title: '等级',
          //   align: 'left',
          //   field: 'level_id',
          //   templet: function (d) {
          //     let field = 'level_id'
          //     if (typeof d[field] == 'undefined') return ''
          //     let items = []
          //     layui.each((d[field] + '').split(','), function (k, v) {
          //       items.push(apiResults[field][v] || v)
          //     })
          //     if (d[field] == 0) {
          //       return 'VIP0'
          //     }
          //     return util.escape(items.join(','))
          //   },
          //   width: 100,
          //   hide: true,
          // },
          {
            title: '金币',
            align: 'left',
            field: 'money',
            width: 100,
          },
          {
            title: '佣金',
            align: 'left',
            field: 'commission',
            width: 100,
          },
          {
            title: '代理数量',
            align: 'left',
            field: 'order_node_total',
            width: 100,
          },
          {
            title: '注册人数',
            align: 'left',
            field: 'invitation_total',
            width: 100,
          },
          {
            title: '总充值金额/总佣金',
            align: 'left',
            field: 'commission',
            templet: function (d) {
              return '<strong style="color: red">'+d.money_recharge+' / '+d.commission_total+'</strong>';
            },
            width: 150,
          },
          {
            title: '注册时间',
            align: 'left',
            field: 'created_at',
            width: 160,
          },
          {
            title: '登录时间',
            align: 'left',
            field: 'login_at',
            width: 160,
          },
          {
            title: 'QQ',
            align: 'left',
            field: 'qq',
            width: 150,
          },
          {
            title: '微信',
            align: 'left',
            field: 'weixin',
            width: 150,
          },
          {
            title: '认证方式',
            align: 'left',
            field: 'ident_type',
            templet: function (d) {
              let field = 'ident_type'
              if (typeof d[field] == 'undefined') return ''
              let items = []
              layui.each((d[field] + '').split(','), function (k, v) {
                items.push(apiResults[field][v] || v)
              })
              return util.escape(items.join(','))
            },
            width: 100,
          },
          {
            title: '认证手机号',
            align: 'left',
            field: 'ident_mobile',
            width: 150,
          },
          {
            title: '真实姓名',
            align: 'left',
            field: 'truename',
            width: 100,
          },
          {
            title: '身份证号',
            align: 'left',
            field: 'id_number',
            width: 180,
          },
          // {
          //   title: '角色',
          //   align: 'left',
          //   field: 'user_status',
          //   templet: function (d) {
          //     let field = 'user_status'
          //     if (typeof d[field] == 'undefined') return ''
          //     let items = []
          //     layui.each((d[field] + '').split(','), function (k, v) {
          //       items.push(apiResults[field][v] || v)
          //     })
          //     return util.escape(items.join(','))
          //   },
          //   width: 100,
          //   hide: true,
          // },
          {
            title: '状态',
            align: 'left',
            field: 'status',
            templet: function (d) {
              let field = 'status'
              form.on('switch(' + field + ')', function (data) {
                let load = layer.load()
                let postData = {}
                postData[field] = data.elem.checked ? 1 : 0
                postData[PRIMARY_KEY] = this.value
                $.post(UPDATE_API, postData, function (res) {
                  layer.close(load)
                  if (res.code) {
                    return layui.popup.failure(res.msg, function () {
                      data.elem.checked = !data.elem.checked
                      form.render()
                    })
                  }
                  return layui.popup.success('操作成功')
                })
              })
              let checked = d[field] === 1 ? 'checked' : ''
              if (parent.Admin.Account.id === d.id) return ''
              return (
                '<input type="checkbox" value="' +
                util.escape(d[PRIMARY_KEY]) +
                '" lay-filter="' +
                util.escape(field) +
                '" lay-skin="switch" lay-text="' +
                util.escape('禁用|正常') +
                '" ' +
                checked +
                '/>'
              )
            },
            width: 100,
          },
          {
            title: '操作',
            toolbar: '#table-bar',
            align: 'left',
            fixed: 'right',
            width: 440,
          },
        ]
        if (user_status == 2) {
          // 表头参数
          cols = [
            {
              type: 'checkbox',
              align: 'left',
              width: 50,
            },
            {
              title: '主键',
              align: 'left',
              field: 'id',
              sort: true,
              width: 110,
            },
            {
              title: '用户名',
              align: 'left',
              field: 'username',
              width: 140,
            },
            {
              title: '手机号',
              align: 'left',
              field: 'mobile',
              width: 150,
            },
            // {
            //   title: '等级',
            //   align: 'left',
            //   field: 'level_id',
            //   templet: function (d) {
            //     let field = 'level_id'
            //     if (typeof d[field] == 'undefined') return ''
            //     let items = []
            //     layui.each((d[field] + '').split(','), function (k, v) {
            //       items.push(apiResults[field][v] || v)
            //     })
            //     if (d[field] == 0) {
            //       return 'VIP0'
            //     }
            //     return util.escape(items.join(','))
            //   },
            //   width: 100,
            //   hide: true,
            // },
            {
              title: '金币',
              align: 'left',
              field: 'money',
              width: 100,
            },
            {
              title: '佣金',
              align: 'left',
              field: 'commission',
              width: 100,
            },
            {
              title: '总充值金额/总佣金',
              align: 'left',
              field: 'commission',
              templet: function (d) {
                return '<strong style="color: red">'+d.money_recharge+' / '+d.commission_total+'</strong>';
              },
              width: 150,
            },
            {
              title: '注册时间',
              align: 'left',
              field: 'created_at',
              width: 200,
            },
            {
              title: '登录时间',
              align: 'left',
              field: 'login_at',
              width: 200,
            },
            {
              title: '认证方式',
              align: 'left',
              field: 'ident_type',
              templet: function (d) {
                let field = 'ident_type'
                if (typeof d[field] == 'undefined') return ''
                let items = []
                layui.each((d[field] + '').split(','), function (k, v) {
                  items.push(apiResults[field][v] || v)
                })
                return util.escape(items.join(','))
              },
              width: 100,
            },
            {
              title: '操作',
              toolbar: '#table-bar',
              align: 'left',
              fixed: 'right',
              width: 240,
            },
          ]
        }

        // 渲染表格
        function render() {
          table.render({
            elem: '#data-table',
            url: SELECT_API,
            page: true, // 是否显示分页
            limits: [20,100, 200, 300,400,500,600,700,800,900,1000],
            limit: 100, // 每页默认显示的数量
            cols: [cols],
            skin: 'line',
            size: 'lg',
            toolbar: '#table-toolbar',
            autoSort: false,
            defaultToolbar: [
              {
                title: '刷新',
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
              },
              'filter',
              'print',
              'exports',
            ],
            done: function (res, curr, count) {
              layer.photos({ photos: 'div[lay-id="data-table"]', anim: 5 });
            },
            where: {
              // 向服务端传递的额外参数
              field: PRIMARY_KEY, // 默认排序的字段
              order: 'desc', // 默认排序方式：asc（升序）或desc（降序）
            },
            initSort: {
              field: PRIMARY_KEY, // 默认排序的字段
              type: 'desc', // 默认排序方式：asc（升序）或desc（降序）
            },
          })
        }

        // 获取表格中下拉或树形组件数据
        let apis = []
        // apis.push(["level_id", "/app/admin/v1-level/select?format=select"]);
        apis.push(['ident_type', '/app/admin/dict/getNew/get_ident_type_list_two'])
        // apis.push(['user_status', '/app/admin/role/select?format=select'])
        let apiResults = {}
        // apiResults['level_id'] = []
        apiResults['ident_type'] = []
        // apiResults['user_status'] = []
        let count = apis.length
        layui.each(apis, function (k, item) {
          let [field, url] = item
          $.ajax({
            url: url,
            dateType: 'json',
            success: function (res) {
              if (res.code) {
                return layui.popup.failure(res.msg)
              }
              function travel(items) {
                for (let k in items) {
                  let item = items[k]
                  apiResults[field][item.value] = item.name
                  if (item.children) {
                    travel(item.children)
                  }
                }
              }
              travel(res.data)
            },
            complete: function () {
              if (--count === 0) {
                render()
              }
            },
          })
        })
        if (!count) {
          render()
        }

        // 编辑或删除行事件
        table.on('tool(data-table)', function (obj) {
          if (obj.event === 'remove') {
            remove(obj)
          } else if (obj.event === 'edit') {
            edit(obj)
          } else if (obj.event === 'money') {
            money(obj)
          } else if (obj.event === 'commission') {
            commission(obj)
          } else if (obj.event === 'invitation') {
            invitation(obj)
          } else if (obj.event === 'user_extend') {
            user_extend(obj)
          } else if (obj.event === 'user_money_log') {
            user_money_log(obj)
          } else if(obj.event === 'more'){
            // 更多 - 下拉菜单
            let value = obj.data[PRIMARY_KEY];
            dropdown.render({
              elem: this, // 触发事件的 DOM 对象
              show: true, // 外部事件触发即显示
              data: [{
                title: '订单列表',
                id: 'order'
              }, {
                title: '订单节点',
                id: 'order_node'
              }, {
                title: '节点过期',
                id: 'order_node_expire'
              }, {
                title: '节点调换记录',
                id: 'order_node_exchange'
              }, {
                title: '节点退款',
                id: 'order_node_refund'
              }, {
                title: '导入(续费/改密)',
                id: 'import'
              }],
              click: function(menudata){
                let title = '';
                let content = '';
                if(menudata.id === 'order'){
                  title = '订单列表';
                  content= '/app/admin/v1-order/index' + '?' + 'user_id' + '=' + value;
                } else if(menudata.id === 'order_node'){
                  title = '订单节点';
                  content= '/app/admin/v1-order-node/index' + '?' + 'user_id' + '=' + value;
                } else if(menudata.id === 'order_node_expire'){
                  title = '节点过期';
                  content= '/app/admin/v1-order-node-expire/index' + '?' + 'user_id' + '=' + value;
                } else if(menudata.id === 'order_node_exchange'){
                  title = '节点调换记录';
                  content= '/app/admin/v1-order-node-exchange/index' + '?' + 'user_id' + '=' + value;
                } else if(menudata.id === 'order_node_refund'){
                  title = '节点退款';
                  content= '/app/admin/v1-order-node-refund/index' + '?' + 'user_id' + '=' + value;
                } else if(menudata.id === 'import'){
                  title = '导入(续费/改密)';
                  content= '/app/admin/v1-node/import' + '?' + 'user_id' + '=' + value;
                }

                layer.open({
                  type: 2,
                  title: title,
                  shade: 0.1,
                  maxmin: true,
                  area: [common.isModile() ? '100%' : '98%', common.isModile() ? '100%' : '95%',],
                  content: content,
                  skin: '',
                })
              },
              id: 'dropdown-table-tool',
              align: 'right', // 右对齐弹出
              style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' // 设置额外样式
            });
          }
        })

        // 表格顶部工具栏事件
        table.on('toolbar(data-table)', function (obj) {
          if (obj.event === 'add') {
            add()
          } else if (obj.event === 'refresh') {
            refreshTable()
          } else if (obj.event === 'batchRemove') {
            batchRemove(obj)
          }
        })

        // 表格顶部搜索事件
        form.on('submit(table-query)', function (data) {
          data.field.field = PRIMARY_KEY
          data.field.order = 'desc'
          console.log(data, 'table-query')
          table.reload('data-table', {
            page: {
              curr: 1,
            },
            where: data.field,
          })
          return false
        })

        // 表格顶部搜索重置事件
        form.on('submit(table-reset)', function (data) {
          let data1 = {}
          data1.field = PRIMARY_KEY
          data1.order = 'desc'
          console.log(data, 'table-reset')
          table.reload('data-table', {
            where: data1,
          })
        })

        // 字段允许为空
        form.verify({
          phone: [/(^$)|^1\d{10}$/, '请输入正确的手机号'],
          email: [
            /(^$)|^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
            '邮箱格式不正确',
          ],
          url: [/(^$)|(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, '链接格式不正确'],
          number: [/(^$)|^\d+$/, '只能填写数字'],
          date: [
            /(^$)|^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,
            '日期格式不正确',
          ],
          identity: [
            /(^$)|(^\d{15}$)|(^\d{17}(x|X|\d)$)/,
            '请输入正确的身份证号',
          ],
        })

        // 表格排序事件
        table.on('sort(data-table)', function (obj) {
          let data = obj.config.where
          data.field = obj.field
          data.order = obj.type
          console.log(data, 'obj')
          table.reload('data-table', {
            initSort: obj,
            scrollPos: 'fixed',
            where: data,
            // where: {
            //     field: obj.field,
            //     order: obj.type
            // }
          })
        })

        // 表格新增数据
        let add = function () {
          layer.open({
            type: 2,
            title: '新增',
            shade: 0.1,
            maxmin: true,
            area: [
              common.isModile() ? '100%' : '98%',
              common.isModile() ? '100%' : '95%',
            ],
            content: INSERT_URL,
            skin: '',
          })
        }

        // 表格编辑数据
        let edit = function (obj) {
          let value = obj.data[PRIMARY_KEY]
          layer.open({
            type: 2,
            title: '修改',
            shade: 0.1,
            maxmin: true,
            area: [
              common.isModile() ? '100%' : '98%',
              common.isModile() ? '100%' : '95%',
            ],
            content: UPDATE_URL + '?' + PRIMARY_KEY + '=' + value,
            skin: '',
          })
        }

        // 删除一行
        let remove = function (obj) {
          return doRemove(obj.data[PRIMARY_KEY])
        }

        // 删除多行
        let batchRemove = function (obj) {
          let checkIds = common.checkField(obj, PRIMARY_KEY)
          if (checkIds === '') {
            layui.popup.warning('未选中数据')
            return false
          }
          doRemove(checkIds.split(','))
        }

        // 执行删除
        let doRemove = function (ids) {
          let data = {}
          data[PRIMARY_KEY] = ids
          layer.confirm(
            '确定删除?',
            {
              icon: 3,
              title: '提示',
            },
            function (index) {
              layer.close(index)
              let loading = layer.load()
              $.ajax({
                url: DELETE_API,
                data: data,
                dataType: 'json',
                type: 'post',
                success: function (res) {
                  layer.close(loading)
                  if (res.code) {
                    return layui.popup.failure(res.msg)
                  }
                  return layui.popup.success('操作成功', refreshTable)
                },
              })
            }
          )
        }

        // 刷新表格数据
        window.refreshTable = function () {
          table.reloadData('data-table', {
            scrollPos: 'fixed',
            done: function (res, curr) {
              if (curr > 1 && res.data && !res.data.length) {
                curr = curr - 1
                table.reloadData('data-table', {
                  page: {
                    curr: curr,
                  },
                })
              }
            },
          })
        }

        // 充值
        let money1 = function (obj) {
          let value = obj.data[PRIMARY_KEY]
          layer.prompt(
            {
              title: '请输入充值金额',
            },
            function (value1, index, elem) {
              let money = util.escape(value1)
              if (money === '' || money == 0) {
                return layui.popup.failure('请输入充值金额')
              }
              layer.close(index)
              let loading = layer.load()
              $.ajax({
                url: MONEY_API,
                data: { id: value, money: money },
                dataType: 'json',
                type: 'post',
                success: function (res) {
                  layer.close(loading)
                  if (res.code) {
                    return layui.popup.failure(res.msg)
                  }
                  return layui.popup.success('操作成功', refreshTable)
                },
                error: function () {
                  layer.close(loading)
                  return layui.popup.failure('网络错误')
                },
              })
            }
          )
        }

        // 余额
        let money = function (obj) {
          let value = obj.data[PRIMARY_KEY]
          layer.open({
            type: 2,
            title: '余额',
            shade: 0.1,
            maxmin: true,
            area: [
              common.isModile() ? '100%' : '60%',
              common.isModile() ? '100%' : '95%',
            ],
            content: MONEY_URL + '?' + PRIMARY_KEY + '=' + value,
            skin: '',
          })
        }

        // 佣金
        let commission = function (obj) {
          let value = obj.data[PRIMARY_KEY]
          layer.open({
            type: 2,
            title: '佣金',
            shade: 0.1,
            maxmin: true,
            area: [
              common.isModile() ? '100%' : '60%',
              common.isModile() ? '100%' : '95%',
            ],
            content: COMMISSION_URL + '?' + PRIMARY_KEY + '=' + value,
            skin: '',
          })
        }

        // 修改上级
        let invitation = function (obj) {
          let value = obj.data[PRIMARY_KEY]
          layer.prompt(
                  {
                    title: '请输入会员ID（为0没有上级）',
                  },
                  function (value1, index, elem) {
                    let invitation_id = util.escape(value1)
                    if (invitation_id === '') {
                      return layui.popup.failure('请输入会员ID')
                    }
                    layer.close(index)
                    let loading = layer.load()
                    $.ajax({
                      url: INVITATION_API,
                      data: { id: value, invitation_id: invitation_id },
                      dataType: 'json',
                      type: 'post',
                      success: function (res) {
                        layer.close(loading)
                        if (res.code) {
                          return layui.popup.failure(res.msg)
                        }
                        return layui.popup.success(res.msg, refreshTable)
                      },
                      error: function () {
                        layer.close(loading)
                        return layui.popup.failure('网络错误')
                      },
                    })
                  }
          )
        }

        // 权限设置
        let user_extend = function (obj) {
          const userId = obj.data.id
          const customPS = CustomPermissionSetting()

          layer.load(1, {
            shade: [0.6, '#000'],
          })
          customPS.getBaseInfo(userId, function () {
            layer.open({
              type: 1,
              title: '权限设置',
              shade: 0.1,
              maxmin: true,
              area: [common.isModile()?"100%":"60%", common.isModile()?"100%":"95%"],
              content: $('.promotion-link-setting-wrapper'),
              skin: '',
              btnAlign: 'c',
              btn: ['确定', '取消'],
              yes: function (index, layero) {
                customPS.saveCurrentForm(function () {
                  layer.close(index)
                  window.refreshTable()
                })
              },
              btn2: function (index, layero) {
                layer.close(index)
              },
              success: function (layero, index) {
                layer.closeAll('loading')
                customPS.renderContact()
              },
            })
          })
        }

        // 资金记录
        let user_money_log = function (obj) {
          let value = obj.data[PRIMARY_KEY]
          layer.open({
            type: 2,
            title: '资金记录',
            shade: 0.1,
            maxmin: true,
            area: [common.isModile() ? '100%' : '98%', common.isModile() ? '100%' : '95%',],
            content: '/app/admin/v1-user-money-log/index' + '?' + 'user_id' + '=' + value,
            skin: '',
          })
        }
      })
    </script>
  </body>
</html>
